<?php

namespace app\index\controller;

use app\common\model\News;

class IndexController
{
    public function index()

    {
        $newsModel = new News();
        $newsList = $newsModel->getAllUpNewsList();
        return json([
            'code'=>0,
            'newsList'=>$newsList,
        ]);
       // $userData = cookie('userData');
       // echo json(['newsList'=>$newsList]);
       // return view('index',['newsList'=>$newsList,'userData'=>$userData]);
    }
    public function getAllList(){
        $newsModel = new News();
        $allList = $newsModel->getAllNewsList();
        return json([
            'code'=>0,
            'allList'=>$allList
        ]);
    }
}
